Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix crash when user clicks on "Task Instance Details" caused by start_date being None #14416

Merged
merged 4 commits into from
Feb 25, 2021

Conversation

yuqian90
Copy link
Contributor

@yuqian90 yuqian90 commented Feb 24, 2021

This is to fix the following error that happens when a user clicks on 'Task Instance Details' for a TaskInstance that has previous TaskInstance not yet run. E.g.

  • The previous TaskInstance has not yet run because its dependencies are not yet met
  • The previous TaskInstance has not yet run because scheduler is busy,
  • the previous TaskInstance was marked success without running.

This bug was caused by #12910. It affects Airflow 2.0.0 and 2.0.1.

...
  File "/opt/airflow/airflow/utils/session.py", line 65, in wrapper
    return func(*args, session=session, **kwargs)
  File "/opt/airflow/airflow/models/taskinstance.py", line 826, in get_previous_start_date
    return prev_ti and pendulum.instance(prev_ti.start_date)
  File "/usr/local/lib/python3.6/site-packages/pendulum/__init__.py", line 174, in instance
    raise ValueError("instance() only accepts datetime objects.")
ValueError: instance() only accepts datetime objects.

Copy link
Member

@XD-DENG XD-DENG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but a minor question to clarify.

tests/models/test_taskinstance.py Show resolved Hide resolved
@kaxil kaxil added this to the Airflow 2.0.2 milestone Feb 24, 2021
@kaxil kaxil merged commit 21f2974 into apache:master Feb 25, 2021
@yuqian90 yuqian90 deleted the fix_none_date branch February 27, 2021 08:11
ashb pushed a commit that referenced this pull request Mar 19, 2021
…_date being None (#14416)

This is to fix the following error that happens when a user clicks on 'Task Instance Details' for a TaskInstance that has previous TaskInstance not yet run. E.g.

The previous TaskInstance has not yet run because its dependencies are not yet met
The previous TaskInstance has not yet run because scheduler is busy,
the previous TaskInstance was marked success without running.
This bug was caused by #12910. It affects Airflow 2.0.0 and 2.0.1.

(cherry picked from commit 21f2974)
kaxil pushed a commit to astronomer/airflow that referenced this pull request Apr 1, 2021
…_date being None (apache#14416)

This is to fix the following error that happens when a user clicks on 'Task Instance Details' for a TaskInstance that has previous TaskInstance not yet run. E.g.

The previous TaskInstance has not yet run because its dependencies are not yet met
The previous TaskInstance has not yet run because scheduler is busy,
the previous TaskInstance was marked success without running.
This bug was caused by apache#12910. It affects Airflow 2.0.0 and 2.0.1.

(cherry picked from commit 21f2974)
(cherry picked from commit 040f7d8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants